home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F25968_AttrToElem.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  1.1 KB  |  29 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       XMLtoXML
  4.   Author:         David Silverlight
  5.                   HeadGeek@xmlpitstop.com
  6.   Created:        2001-05-16
  7.   Description:-
  8.     This stylsheet will convert an xml file that is
  9.     attribute-based to one that is element-based.  In this
  10.     stylesheet, the original customer elements are represented
  11.     as a series of attributes. The output of this transformation
  12.     will be a number of child elements, one for each attribute.
  13. ================================================================ -->
  14. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  15.     <xsl:output method="xml"/>
  16.     <xsl:template match="/">
  17.         <customers>
  18.             <xsl:for-each select="/customers/customer">
  19.                 <xsl:element name="{name()}">
  20.                     <xsl:for-each select="@*">
  21.                         <xsl:element name="{name()}">
  22.                             <xsl:value-of select="."/>
  23.                         </xsl:element>
  24.                     </xsl:for-each>
  25.                 </xsl:element>
  26.             </xsl:for-each>
  27.         </customers>
  28.     </xsl:template>
  29. </xsl:stylesheet>